#include<iostream>
using namespace std;

int findMaxConsecutiveOnes(int nums[], int size) {
    int maxCount = 0;
    int currentCount = 0;

    for (int i = 0; i < size; i++) {
        if (nums[i] == 1) {
            currentCount++;
        }
        else {
            if (currentCount > maxCount) {
                maxCount = currentCount;
            }
            currentCount = 0;
        }
    }

    if (currentCount > maxCount) {
        maxCount = currentCount;
    }

    return maxCount;
}

int main() {
    int nums[] = {1, 1, 0, 1, 1, 1, 0, 1};
    int size = sizeof(nums) / sizeof(nums[0]);

    int maxConsecutiveOnes = findMaxConsecutiveOnes(nums, size);

    cout << "最大连续1的个数为:" << maxConsecutiveOnes << endl;

    return 0;
}